import org.scalatest.{FlatSpec, GivenWhenThen}

import scala.collection.mutable

/**
  * Informers
  * One of the parameters to FlatSpec's run method is a Reporter,
  * which will collect and report information about the running suite of tests.
  * Information about suites and tests that were run, whether tests succeeded or failed,
  * and tests that were ignored will be passed to the Reporter as the suite runs.
  */
class GivenWhenThenDemo extends FlatSpec with GivenWhenThen {

  "A mutable Set" should "allow an element to be added" in {
    Given("an empty mutable Set")
    val set = mutable.Set.empty[String]

    When("an element is added")
    set += "clarity"

    Then("the Set should have size 1")
    assert(set.size === 1)

    And("the Set should contain the added element")
    assert(set.contains("clarity"))

    info("That's all folks!")
  }
}